'''
Created on 05/05/2010

@author: emlyn
'''

from FullPageHandler import FullPageHandler
from EditPageHandler import EditPageHandler
from EditPagesHandler import EditPagesHandler
from DeletePageHandler import DeletePageHandler
from EditWebSitesHandler import EditWebSitesHandler
from EditWebSiteHandler import EditWebSiteHandler
from DeleteWebsiteHandler import DeleteWebsiteHandler
from ChangeWebsiteHandler import ChangeWebsiteHandler
from RemoveUserFromSiteHandler import RemoveUserFromSiteHandler
from EditFilesHandler import EditFilesHandler
from EditFileHandler import EditFileHandler
from DeleteFileHandler import DeleteFileHandler
from FileHandler import FileHandler

class ApplicationInit(object):
    '''
    This class adds the required application initialisation array info for accessing 
    all the pages in the Pages package.
    '''


    def __init__(self):
        '''
        Constructor
        '''

    def InitWSGIApplicationArray(self, resultarray, CanManageWebsite):
        pagesarray = [
         ('/', FullPageHandler), 
         ('/page', FullPageHandler),
         ('/editpage', EditPageHandler),
         ('/editpages', EditPagesHandler),
         ('/deletepage', DeletePageHandler),
         ('/file', FileHandler),
         ('/editfiles', EditFilesHandler),
         ('/editfile', EditFileHandler),     
         ('/deletefile', DeleteFileHandler)     
        ]
        
        managewebsitearray = [
         ('/editwebsites', EditWebSitesHandler),
         ('/editwebsite', EditWebSiteHandler),
         ('/deletewebsite', DeleteWebsiteHandler),
         ('/changewebsite', ChangeWebsiteHandler),
         ('/removeuserfromsite', RemoveUserFromSiteHandler)
        ]
        
        if (CanManageWebsite):
            resultarray.extend(managewebsitearray)
            
        resultarray.extend(pagesarray)
        
        return resultarray
    InitWSGIApplicationArray = classmethod(InitWSGIApplicationArray)
